package cn.roadtrip.mtravelbusinessmodule.mvc.productorder;

import cn.roadtrip.mtravelbusinessmodule.bs.shopproduct.ShopProductOrderImpl;
import cn.roadtrip.utilmodule.util.DataBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/productorder")
public class ShopProductOrderController {
    @Autowired
    private ShopProductOrderImpl shopProductOrderImpl;

    /**
     * 商品预支付，返回订单号，以及签名
     *
     * @param model
     * @return
     */
    @PostMapping("/productPrePay")
    public DataBean productPrePay(@RequestBody ShopProductOrderImpl.Model_productPrePay model) {

        return shopProductOrderImpl.productPrePay(model);
    }

    /**
     * 商品订单付款操作--api操作
     *
     * @param model
     * @return
     */
    @PostMapping("/payProductOrderFromAPI")
    public DataBean payProductOrderFromAPI(
            @RequestBody ShopProductOrderImpl.Model_payProductOrder model
    ) {
        return shopProductOrderImpl.payProductOrderFromAPI(model);
    }

    /**
     * 商品订单付款操作--回调操作
     *
     * @param model
     * @return
     */
    @PostMapping("/payProductOrderFromCallBack")
    public DataBean payProductOrderFromCallBack(
            @RequestBody ShopProductOrderImpl.Model_payProductOrder model
    ) {
        return shopProductOrderImpl.payProductOrderFromCallBack(model);
    }

    /**
     * 查询用户的商品订单
     *
     * @param model
     * @return
     */
    @PostMapping("/queryUserShopProductOrderList")
    public DataBean payProductOrderFromCallBack(
            @RequestBody ShopProductOrderImpl.Model_queryUserShopProductOrderList model
    ) {
        return shopProductOrderImpl.queryUserShopProductOrderList(model);
    }



    /**
     * 创建产品核临时销码
     *
     * @param model
     * @return
     */
    @PostMapping("/createProductDealCode")
    public DataBean createProductDealCode(
            @RequestBody ShopProductOrderImpl.Model_createProductDealCode model
    ) {
        return shopProductOrderImpl.createProductDealCode(model);
    }



    /**
     * 核销产品订单
     *
     * @param model
     * @return
     */
    @PostMapping("/dealProductOrder")
    public DataBean dealProductOrder(
            @RequestBody ShopProductOrderImpl.Model_deaProductOrder model
    ) {
        return shopProductOrderImpl.dealProductOrder(model);
    }
}
